<?php
class ExcursionController extends Zend_Controller_Action
{
	private $_db = null;
	
	public function init(){
		$registry = Zend_Registry::getInstance();
		$this->_db = $registry->get('db');
	}
	
	public function indexAction()
	{
		
	}

        public function viewAction()
	{
            $breadcrumb= Array ("0" =>Array("title" => "Home", "url" => "/index/" ) ,"1" => Array("title" =>"Excursions","url"=>"" ) );
            $this->view->breadcrumb()->set($breadcrumb);
            $this->_helper->layout->setLayout('layout');
            Zend_Loader::loadFile("../application/default/models/Excursion.php");
            Zend_Loader::loadFile("../application/default/models/Aboutcountry.php");

            $sess = new Zend_Session_Namespace('locale');
            $curr_lang = $sess->current_lang;
            if($curr_lang != '')
            {
                $lang = $curr_lang;
            } else {
                $lang = 'en';
	    }

            $itemperpage = $config->application->itemperpage;
            $model_excursion = new Excursion();
            $request = $this->getRequest();
            $exc_arr = $model_excursion->getExcursions();

                $page=$this->_getParam('page',1);
                $paginator = Zend_Paginator::factory($exc_arr);
                $paginator->setItemCountPerPage($itemperpage);
                $paginator->setCurrentPageNumber($page);

                $this->view->paginator=$paginator;
            $this->view->exc_arr = $exc_arr;
            $this->view->lang = $lang;
	}
	
	public function detailsAction()
	{
            $breadcrumb= Array ("0" =>Array("title" => "Excursions", "url" => "/excursion/view/" ) ,"1" => Array("title" =>"Excursion Details","url"=>"" ) );
                $this->view->breadcrumb()->set($breadcrumb);
		$this->_helper->layout->setLayout('layout');
		Zend_Loader::loadFile("../application/default/models/Excursion.php");
		//Zend_Loader::loadFile("../application/default/models/Aboutcountry.php");
		
		$sess = new Zend_Session_Namespace('locale');
        $curr_lang = $sess->current_lang;
        if($curr_lang != '')
        {
            $lang = $curr_lang;
        } else {
    	    $lang = 'en';
	    }
		
		$model_excursion = new Excursion();
		$request = $this->getRequest();
		$exc_id = $request->getParam('exc_id', 0);
		$excursion_arr = $model_excursion->getExcursionDetails($exc_id);
		$this->view->excursion_arr = $excursion_arr;
		$this->view->lang = $lang;
	}
}	
?>	